home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / libogg / libvorbis-1.0rc3 / vq / auxpartition.pl next >
Encoding:
Perl Script  |  2002-10-27  |  1.1 KB  |  72 lines

  1. #!/usr/bin/perl
  2.  
  3. if($#ARGV<0){
  4.     &usage;
  5. }
  6.  
  7. $|=1;
  8.  
  9. $bands=0;
  10.  
  11. foreach $arg (@ARGV){
  12.     ($entries[$bands],$file[$bands])=split(/,/,$arg);
  13.     $bands++;
  14. }
  15.  
  16. # no time to deal with globs right now
  17. if($bands>0){
  18.     die unless open(ONE,"<".$file[0]);
  19. }
  20. if($bands>1){
  21.     die unless open(TWO,"<".$file[1]);
  22. }
  23. if($bands>2){
  24.     die unless open(THREE,"<".$file[2]);
  25. }
  26.  
  27.  
  28. while (<ONE>) {    
  29.     my@nums = ();
  30.     @nums = split(/,/);
  31.     my$cols=$#nums;
  32.     for($i=0;$i<$cols;$i++){
  33.     print 0+$nums[$i].", ";
  34.     }
  35.     if($bands>1){
  36.     $_=<TWO>;
  37.     @nums = ();
  38.     @nums = split(/,/);
  39.     $cols=$#nums;
  40.     for($i=0;$i<$cols;$i++){
  41.         print $nums[$i]+$entries[0].", ";
  42.     }
  43.     if($bands>2){
  44.         $_=<THREE>;
  45.         @nums = ();
  46.         @nums = split(/,/);
  47.         $cols=$#nums;
  48.         for($i=0;$i<$cols;$i++){
  49.         print $nums[$i]+$entries[0]+$entries[1].", ";
  50.         }
  51.     }
  52.     }
  53.     print "\n";
  54.  
  55. }
  56.  
  57. if($bands>0){
  58.     close ONE;
  59. }
  60. if($bands>1){
  61.     close TWO;
  62. }
  63. if($bands>2){
  64.     close THREE;
  65. }
  66.     
  67. sub usage{
  68.     print "\nOggVorbis auxbook spectral partitioner\n\n";
  69.     print "auxpartition.pl <part_entries>,file [<part_entries>,file...]\n\n";
  70.     exit(1);
  71. }
  72.